package com.situ.mall.common.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.situ.mall.common.entity.Member;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author JavaWizard
 * @since 2023-09-19
 */
@Mapper
public interface MemberMapper extends BaseMapper<Member> {
/* 前端请求 */
    //注册保存
    @Insert("insert into member(tel, password) values (#{phoneNumber}, #{password1})")
    void register(String phoneNumber, String password1);



//    //根据用户名查用户
//    @Select("select * from member where member_name = #{memberName} and status = 0")
//    Member selectByMemberName(String memberName);
//
//    //注册保存
//    @Insert("insert into member(member_name, password, tel) values (#{memberName}, #{password}, #{tel})")
//    void register(@Param("memberName")String memberName, @Param("password")String password, @Param("tel")String tel);
//
//    //修改个人资料（根据用户id查用户）
//    @Select("select * from member where id = #{id}")
//    Member selectByMemberId(Integer id);
//
//    //保存个人资料
//    void update(Member member);

/* 后端操作 */
    //查询渲染表格
    List<Member> list(@Param("memberName")String memberName, @Param("tel")String tel);

    //重置密码——根据ID查询用户名带到前台
//    @Select("select password from member where id = #{id}")
//    String selectById(Integer id);

    //查电话号码有没有被注册
    @Select("select * from member where tel = #{tel}")
    Member selectByTel(String tel);


}
